package com.ykj.controller;


import com.ykj.dto.Result;
import com.ykj.service.CollectService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Y2014188432
 * @since 2022-05-17
 */
@RestController
@RequestMapping("/collect")
public class CollectController {

    @Resource
    private CollectService collectService;

    @GetMapping("/addByStateAndTypeId")
    public Result addByStateAndTypeId(String state,String typeId){
        return collectService.addByStateAndTypeId(state,typeId);
    }


    /**
     * 判读目标是否收藏
     * @param state 1 板块、2 帖子
     * @param userId 用户 id
     * @param typeId 目标 id
     * @return R
     */
    @GetMapping("/getIfCollectByUserIdAndStateAndTypeId")
    public Result getIfCollectByUserIdAndStateAndTypeId(String state,String userId,String typeId){
        return collectService.getIfCollectByUserIdAndStateAndTypeId(state,userId,typeId);
    }
}

